package com.example.day2.mvvm.base;

import android.os.Bundle;
import android.os.PersistableBundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.lifecycle.ViewModelProvider;

public abstract class BaseActivity <VDB extends ViewDataBinding,VM extends BaseViewModel>extends AppCompatActivity {
    protected VDB binding;
    protected VM viewModel;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        binding = DataBindingUtil.setContentView(this,bindLayoutId());

        viewModel = new ViewModelProvider(this).get(getVIewModel());

        initView();
        initData();
    }

    public abstract void initView();

    public abstract void initData();

    public abstract Class<VM> getVIewModel();

    public abstract int bindLayoutId();


}
